/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2023-08-25     wyj       the first version
 */
#ifndef _DISTANCE_SENSOR_HPP_
#define _DISTANCE_SENSOR_HPP_

#include "drivers_module.hpp"

typedef enum
{
    distance_status_ok,
    distance_status_fail,
} distance_status;


class DISTANCE_SONIC
{
private:

    CHIP_UART *uart;
    CHIP_OUTPUT_PIN *rs485_en;

    distance_status init_flag;
    uint8_t debug_flag;

public:
    DISTANCE_SONIC(CHIP_UART *uart,CHIP_OUTPUT_PIN *rs485_en);
    ~DISTANCE_SONIC();
    distance_status DISTANCE_SONIC_read_distance(double *read_buff);
    distance_status DISTANCE_SONIC_change_angle();
    void DISTANCE_SONIC_open_debug();
};


#endif /* _DISTANCE_SENSOR_HPP_ */
